<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="../style/common.css" />
    <link rel="stylesheet" href="../style/index.css" />
  </head>
  <style>
    ul li .form-con > button {
      width: 200px;
    }
  </style>
  <body>
    <div class="app">
      <div class="navigation disable-select">
        <nav></nav>
      </div>
      <div class="container">
        <ul>
          <li>
            <div class="form-con">
              <button id="auth">授权（AUTH）</button>
            </div>
          </li>
          <li>
            <div class="form-con">
              <button id="canclAuth">取消授权（CANCEL AUTH）</button>
            </div>
          </li>
          <li>
            <div class="form-con">
              <button id="rfidPaird">进入配卡模式（RFID PAIRD）</button>
            </div>
          </li>
          <li>
            <div class="form-con">
              <button id="reset">重启（RESET）</button>
            </div>
          </li>
          <li>
            <div class="form-con">
              <button id="factory">恢复出厂设置（FACTORY）</button>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </body>
  <script>
    // 加载菜单栏
    const lists = [
      {
        name: "系统运行信息",
        href: "http://127.0.0.1:5501/index.html",
      },
      { name: "功能配置", href: "http://127.0.0.1:5501/views/fun-config.html" },
      {
        name: "WIFI配置",
        href: "http://127.0.0.1:5501/views/wifi-config.html",
      },
      {
        name: "WALLBOX控制",
        href: "http://127.0.0.1:5501/views/wall-box.html",
        active: true,
      },
      { name: "OTA", href: "http://127.0.0.1:5501/views/ota.html" },
    ];
    lists.forEach((item) => {
      const a = document.createElement("a");
      a.target = "_self";
      a.href = item.href;
      a.innerText = item.name;
      if (item.active) {
        a.classList.add("active");
      }
      document.querySelector("nav").appendChild(a);
    });
    // 加载菜单栏

    // 授权
    document.getElementById("auth").addEventListener("click", (e) => {
      console.log("授权");
    });
    // 取消授权
    document.getElementById("canclAuth").addEventListener("click", (e) => {
      console.log("取消授权");
    });
    // 进入配卡模式
    document.getElementById("rfidPaird").addEventListener("click", (e) => {
      console.log("进入配卡模式");
    });
    // 重启
    document.getElementById("reset").addEventListener("click", (e) => {
      console.log("重启");
    });
    // 恢复出厂设置
    document.getElementById("factory").addEventListener("click", (e) => {
      console.log("恢复出厂设置");
    });
  </script>
</html>
